import {
  getRoomList
} from '@/services'
const state = {
  roomList: []
}

const mutations = {
  update(state, payload) {
    for (let key in payload) {
      state[key] = payload[key];
    }
  }
}

const actions = {
  async getRoomList({
    commit
  }) {
    let result = await getRoomList();
    if (result.code === 0){
      commit('update', {roomList: result.data.room_info})
    }
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}